package com.mark.search.dto;

import lombok.Data;
import java.io.Serializable;

/**
 * 返回对象
 *
 * @author wangjie
 * @date 2021/5/7 13:53
 */
@Data
public class ResponseVO<T> implements Serializable {

    private static final long serialVersionUID = -5634676202510446697L;

    private Integer code;


    private String message;

    private T data;

    public static <T> ResponseVO<T> success(T data) {
        ResponseVO<T> responseVO = new ResponseVO<T>();
        responseVO.setCode(200);
        responseVO.setMessage("请求成功");
        responseVO.setData(data);
        return responseVO;
    }


    public static <T> ResponseVO<T> error(Integer code, String message, T data) {
        ResponseVO<T> responseVO = new ResponseVO<T>();
        responseVO.setCode(code);
        responseVO.setMessage(message);
        responseVO.setData(data);
        return responseVO;
    }

}
